import logging, os, os.path
log = logging.getLogger(os.path.basename(__file__))

import traceback
class LoggingMiddleware(object):
    def process_exception(self, request, exception):
        log.error(str(traceback.format_exc()).strip())
